#include <memory>
#include <iostream>

using namespace std;

class Demo {
public:
    string name;

    Demo(string name)
    {
        this->name = name;
        cout << "Demo constructor, name: " << name << endl;
    }

    ~Demo()
    {
        cout << "Demo destructor, name: " << name << endl;
    }
};

void Foo()
{
    shared_ptr<Demo> p = make_shared<Demo>("Brook");
    cout << "Foo, hello, " << p->name << endl;
}

int main()
{
    Foo();
    cout << "After Foo()" << endl;

    return 0;
}
